﻿using Manon.Admin.Web.ApplicationCore.Dtos.Settings;
using Manon.Admin.Web.ApplicationCore.Interfaces;
using Manon.Core.IOC;
using Manon.Core.Commons;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Manon.Admin.Web.Controllers
{
    public class ShieldingController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }


        #region 屏蔽词相关
        /// <summary>
        /// 获取用户屏蔽词
        /// </summary>
        /// <returns></returns>
        [Authorize]
        [HttpGet]
        public async Task<GetGetSysShieldingOutput> GetSysShielding()
        {

            var settingsService = Resolver.GetService<ISettingsService>();
            var result = await settingsService.GetSysShielding();

            return result;
        }

        /// <summary>
        /// 保存屏蔽词
        /// </summary>
        /// <param name="Input"></param>
        /// <returns></returns>
        [Authorize]
        [HttpPost]
        public async Task<Result> SaveSysShielding([FromBody] SaveSysShieldingInput Input)
        {

            var settingsService = Resolver.GetService<ISettingsService>();
            var result = await settingsService.SaveSysShielding(Input);

            return result;
        }
        #endregion
    }
}
